package com.iknow.ui.model;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.iknow.data.IdentityFlag;
import java.util.ArrayList;
import java.util.List;

public class PersonalFlagAdapter extends BaseAdapter
{
  private Context mContext;
  private List<IdentityFlag> mIdentityFlagList;
  private LayoutInflater mInflater = null;

  public PersonalFlagAdapter(Context paramContext, LayoutInflater paramLayoutInflater)
  {
    this.mIdentityFlagList = new ArrayList();
    this.mContext = paramContext;
    this.mInflater = paramLayoutInflater;
  }

  private View createView()
  {
    View localView = this.mInflater.inflate(2130903114, null);
    ViewHolder localViewHolder = new ViewHolder(this, null);
    localViewHolder.mNameText = ((TextView)localView.findViewById(2131296458));
    localView.setTag(localViewHolder);
    return localView;
  }

  public void addFlag(IdentityFlag paramIdentityFlag)
  {
    this.mIdentityFlagList.add(paramIdentityFlag);
  }

  public int getCount()
  {
    return this.mIdentityFlagList.size();
  }

  public IdentityFlag getItem(int paramInt)
  {
    IdentityFlag localIdentityFlag;
    if ((paramInt < 0) || (paramInt > getCount()))
      localIdentityFlag = null;
    while (true)
    {
      return localIdentityFlag;
      localIdentityFlag = (IdentityFlag)this.mIdentityFlagList.get(paramInt);
    }
  }

  public long getItemId(int paramInt)
  {
    return paramInt;
  }

  public View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
  {
    View localView;
    if (paramView == null)
      paramView = createView();
    IdentityFlag localIdentityFlag = getItem(paramInt);
    if (localIdentityFlag == null)
      localView = null;
    while (true)
    {
      return localView;
      ((ViewHolder)paramView.getTag()).mNameText.setText(localIdentityFlag.getName());
      localView = paramView;
    }
  }

  private class ViewHolder
  {
    public TextView mNameText;
  }
}